import App from './App'
import store from '@/store'

import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'


import Cache from './utils/cache'
import util from 'utils/util'
import configs from './config/app.js'

// #ifdef H5
import {
	parseQuery
} from "@/utils";
import Auth from '@/api/base/wechat';
import {
	SPREAD
} from '@/config/cache';
Vue.prototype.$wechat = Auth;
let cookieName = "VCONSOLE",
	query = parseQuery(),
	urlSpread = query["spread"],
	vconsole = query[cookieName.toLowerCase()],
	md5Tt = "b14d1e9baeced9bb7525ab19ee35f2d2", //tongtong MD5 加密开启vconsole模式
	md5UnTt = "3dca2162c4e101b7656793a1af20295c"; //tongtong MD5 加密关闭vconsole模式

if (urlSpread !== undefined) {
	var spread = Cache.get(SPREAD);
	urlSpread = parseInt(urlSpread);
	if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
		Cache.set("spread", urlSpread || 0);
	} else if (spread === 0 || typeof spread !== "number") {
		Cache.set("spread", urlSpread || 0);
	}
}
//#endif

Vue.prototype.$store = store;
Vue.prototype.$util = util;
Vue.prototype.$config = configs;
Vue.prototype.$Cache = Cache;

// 引入TuniaoUI提供的vuex简写方法
let vuexStore = require('@/store/$t.mixin.js')
Vue.mixin(vuexStore)

// 引入全局TuniaoUI
import TuniaoUI from 'uni_modules/tuniao-ui'
Vue.use(TuniaoUI)

// 引入TuniaoUI对小程序分享的mixin封装
let mpShare = require('uni_modules/tuniao-ui/libs/mixin/mpShare.js')
Vue.mixin(mpShare)

const app = new Vue({
	store,
	...App
})

app.$mount()